package com.bbu.javaexam.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bbu.javaexam.domain.PaperManage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Alex
 * @version 1.0.0
 * @ClassName PaperMapper.java
 * @Description TODO
 */
@Mapper
public interface PaperMapper extends BaseMapper<PaperManage> {
    /**
     * @throws
     * @title 查找所有的试卷
     * @description
     * @author Alex
     */
    @Select("select paperId, questionType,questionId from paper_manage")
    List<PaperManage> findAll();

    /**
     * @throws
     * @title 通过试卷ID查找试卷
     * @description
     * @author Alex
     */
    @Select("select paperId, questionType,questionId from paper_manage where paperId = #{paperId}")
    List<PaperManage> findById(Integer paperId);

    /**
     * @throws
     * @title 新增试卷
     * @description
     * @author Alex
     */
    @Insert("insert into paper_manage(paperId,questionType,questionId) values " +
            "(#{paperId},#{questionType},#{questionId})")
    int add(PaperManage paperManage);
}
